home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 November / PCWorld_2007-11_cd.bin / v cisle / softatlas / SDA16.exe / {app} / rssfeednoimg.xslt < prev    next >
Extensible Markup Language  |  2007-02-03  |  16KB  |  450 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--Copyright SOFTATLAS LTD 2006. Using without SoftAtlas permision is strongly prohibited.-->
  3. <xsl:stylesheet version="1.0"
  4.                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  5.                 xmlns:nsAtom="http://www.w3.org/2005/Atom"
  6.                 xmlns:nsAtom03="http://purl.org/atom/ns#"
  7.                 xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" 
  8.                 xmlns:nsrss="http://purl.org/rss/1.0/" 
  9.                 xmlns:dc="http://purl.org/dc/elements/1.1/" 
  10.                 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  11.                 xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" 
  12.                 xmlns:fn="http://www.w3.org/2005/xpath-functions" 
  13.                 xmlns:user="urn:user" 
  14.         xmlns:var="urn:var" 
  15.   xmlns:xs="http://www.w3.org/2001/XMLSchema" 
  16.   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  17.   exclude-result-prefixes="user xs fn  user" >
  18.   <xsl:template match="/">
  19.     <html>
  20.       <head>
  21.         <meta>
  22.           <xsl:attribute name="content">text/html; charset=utf-8</xsl:attribute>
  23.           <xsl:attribute name="http-equiv">content-type</xsl:attribute>
  24.         </meta>
  25.         <link href="main.css" rel="stylesheet" type="text/css" />
  26.         <title>RSS Feed</title>
  27.       </head>
  28.       <xsl:element name="body">
  29.         <xsl:attribute name="class">cTitlesBody</xsl:attribute>
  30.         <xsl:apply-templates select="rss"></xsl:apply-templates>
  31.         <xsl:apply-templates select="rdf:RDF"></xsl:apply-templates>
  32.         <xsl:apply-templates select="nsAtom:feed"></xsl:apply-templates>
  33.         <xsl:apply-templates select="nsAtom03:feed"></xsl:apply-templates>
  34.       </xsl:element>
  35.     </html>
  36.   </xsl:template>
  37.   <xsl:template match="nsAtom03:feed">
  38.     <div>
  39.       <xsl:attribute name="class">cChannel</xsl:attribute>
  40.       <h1>
  41.         <xsl:attribute name="class">cChannelTitle</xsl:attribute>
  42.         <xsl:value-of select="nsAtom03:title" />
  43.       </h1>
  44.       <xsl:apply-templates select="nsAtom03:link" />
  45.       <div>
  46.         <xsl:attribute name="class">cChannelSubtitle</xsl:attribute>
  47.         <xsl:value-of select="nsAtom03:subtitle" />
  48.       </div>
  49.       <div>
  50.         <xsl:attribute name="class">cChannelDate</xsl:attribute>
  51.         <xsl:value-of select="nsAtom03:updated" />
  52.       </div>
  53.       <xsl:apply-templates select="nsAtom03:entry" />
  54.       <div>
  55.         <xsl:attribute name="class">cChannelRights</xsl:attribute>
  56.         <xsl:value-of select="nsAtom03:rights" />
  57.       </div>
  58.     </div>
  59.   </xsl:template>
  60.   <xsl:template match="nsAtom03:entry">
  61.     <div>
  62.       <xsl:attribute name="class">cItem</xsl:attribute>
  63.       <xsl:element name="a">
  64.         <xsl:attribute name="name">
  65.           <xsl:value-of select="concat('rssitem',position())"/>
  66.         </xsl:attribute>
  67.       </xsl:element>
  68.       <h2>
  69.         <xsl:attribute name="class">cItemTitle</xsl:attribute>
  70.         <xsl:value-of select="nsAtom03:title" />
  71.       </h2>
  72.       <xsl:for-each select="nsAtom03:link">
  73.         <a>
  74.           <xsl:attribute name="class">cItemLink</xsl:attribute>
  75.           <xsl:attribute name="href">
  76.             <xsl:value-of select="@href" />
  77.           </xsl:attribute>
  78.           <xsl:attribute name="title">
  79.             <xsl:value-of select="@href" />
  80.           </xsl:attribute>
  81.           <!--<xsl:value-of select="@href" />-->
  82.           Link to article.
  83.         </a>
  84.       </xsl:for-each>
  85.       <div>
  86.         <xsl:attribute name="class">cItemDescription</xsl:attribute>
  87.         <xsl:value-of select="nsAtom03:content" />
  88.       </div>
  89.       <div>
  90.         <xsl:attribute name="class">cItemDescription</xsl:attribute>
  91.         <xsl:value-of select="nsAtom03:summary" />
  92.       </div>
  93.       <xsl:apply-templates select="nsAtom03:author" />
  94.       <xsl:apply-templates select="nsAtom03:category" />
  95.     </div>
  96.   </xsl:template>
  97.   <xsl:template match="nsAtom03:category">
  98.     <div>
  99.       <xsl:attribute name="class">cItemCategory</xsl:attribute>
  100.       <a>
  101.         <xsl:attribute name="href">
  102.           <xsl:value-of select="@scheme" />
  103.         </xsl:attribute>
  104.         <xsl:attribute name="title">
  105.           <xsl:value-of select="@scheme" />
  106.         </xsl:attribute>
  107.         <xsl:value-of select="@label" />
  108.       </a>
  109.     </div>
  110.   </xsl:template>
  111.   <xsl:template match="nsAtom03:author">
  112.     <div>
  113.       <xsl:attribute name="class" >cItemAuthor</xsl:attribute>
  114.       <a>
  115.         <xsl:attribute name="class">cItemAuthorEmail</xsl:attribute>
  116.         <xsl:attribute name="href">
  117.           <xsl:value-of select="nsAtom03:email" />
  118.         </xsl:attribute>
  119.         <xsl:attribute name="title">
  120.           <xsl:value-of select="nsAtom03:email" />
  121.         </xsl:attribute>
  122.         <xsl:value-of select="nsAtom03:email" />
  123.       </a>
  124.     </div>
  125.   </xsl:template>
  126.   <xsl:template match="nsAtom03:link">
  127.     <a>
  128.       <xsl:attribute name="class">cChannelLink</xsl:attribute>
  129.       <xsl:attribute name="href">
  130.         <xsl:value-of select="@href" />
  131.       </xsl:attribute>
  132.       <xsl:attribute name="title">
  133.         <xsl:value-of select="@href" />
  134.       </xsl:attribute>
  135.       <xsl:if test="'self'=@rel">
  136.         Link to channel.
  137.       </xsl:if>
  138.       <xsl:if test="'self'!=@rel">
  139.         Link to channel home.
  140.       </xsl:if>
  141.       <!-- <xsl:value-of select="@href" />-->
  142.     </a>
  143.   </xsl:template>
  144.   <xsl:template match="nsAtom:feed">
  145.     <div>
  146.       <xsl:attribute name="class">cChannel</xsl:attribute>
  147.       <h1>
  148.         <xsl:attribute name="class">cChannelTitle</xsl:attribute>
  149.         <xsl:value-of select="nsAtom:title" />
  150.       </h1>
  151.       <xsl:apply-templates select="nsAtom:link" />
  152.       <div>
  153.         <xsl:attribute name="class">cChannelSubtitle</xsl:attribute>
  154.         <xsl:value-of select="nsAtom:subtitle" />
  155.       </div>
  156.       <div>
  157.         <xsl:attribute name="class">cChannelDate</xsl:attribute>
  158.         <xsl:value-of select="nsAtom:updated" />
  159.       </div>
  160.       <xsl:apply-templates select="nsAtom:entry" />
  161.       <div>
  162.         <xsl:attribute name="class">cChannelRights</xsl:attribute>
  163.         <xsl:value-of select="nsAtom:rights" />
  164.       </div>
  165.     </div>
  166.   </xsl:template>
  167.   <xsl:template match="nsAtom:entry">
  168.     <div>
  169.       <xsl:attribute name="class">cItem</xsl:attribute>
  170.       <xsl:element name="a">
  171.           <xsl:attribute name="name">
  172.           <xsl:value-of select="concat('rssitem',position())"/>
  173.         </xsl:attribute>
  174.       </xsl:element>
  175.       <h2>
  176.         <xsl:attribute name="class">cItemTitle</xsl:attribute>
  177.         <xsl:value-of select="nsAtom:title" />
  178.       </h2>
  179.       <xsl:for-each select="nsAtom:link">
  180.         <a>
  181.           <xsl:attribute name="class">cItemLink</xsl:attribute>
  182.           <xsl:attribute name="href">
  183.             <xsl:value-of select="@href" />
  184.           </xsl:attribute>
  185.           <xsl:attribute name="title">
  186.             <xsl:value-of select="@href" />
  187.           </xsl:attribute>
  188.           <!--<xsl:value-of select="@href" />-->
  189.           Link to article.
  190.         </a>
  191.       </xsl:for-each>
  192.       <div>
  193.         <xsl:attribute name="class">cItemDescription</xsl:attribute>
  194.         <xsl:value-of select="nsAtom:content" />
  195.       </div>
  196.       <div>
  197.         <xsl:attribute name="class">cItemDescription</xsl:attribute>
  198.         <xsl:value-of select="nsAtom:summary" />
  199.       </div>
  200.       <xsl:apply-templates select="nsAtom:author" />
  201.       <xsl:apply-templates select="nsAtom:category" />
  202.     </div>
  203.   </xsl:template>
  204.   <xsl:template match="nsAtom:category">
  205.     <div>
  206.       <xsl:attribute name="class">cItemCategory</xsl:attribute>
  207.       <a>
  208.         <xsl:attribute name="href">
  209.           <xsl:value-of select="@scheme" />
  210.         </xsl:attribute>
  211.         <xsl:attribute name="title">
  212.           <xsl:value-of select="@scheme" />
  213.         </xsl:attribute>
  214.         <xsl:value-of select="@label" />
  215.       </a>
  216.     </div>
  217.   </xsl:template>
  218.   <xsl:template match="nsAtom:author">
  219.     <div>
  220.       <xsl:attribute name="class" >cItemAuthor</xsl:attribute>
  221.       <a>
  222.         <xsl:attribute name="class">cItemAuthorEmail</xsl:attribute>
  223.         <xsl:attribute name="href">
  224.           <xsl:value-of select="nsAtom:email" />
  225.         </xsl:attribute>
  226.         <xsl:attribute name="title">
  227.           <xsl:value-of select="nsAtom:email" />
  228.         </xsl:attribute>
  229.         <xsl:value-of select="nsAtom:email" />
  230.       </a>
  231.     </div>
  232.   </xsl:template>
  233.   <xsl:template match="nsAtom:link">
  234.     <a>
  235.       <xsl:attribute name="class">cChannelLink</xsl:attribute>
  236.       <xsl:attribute name="href">
  237.         <xsl:value-of select="@href" />
  238.       </xsl:attribute>
  239.       <xsl:attribute name="title">
  240.         <xsl:value-of select="@href" />
  241.       </xsl:attribute>
  242.       <xsl:if test="'self'=@rel">
  243.         Link to channel.
  244.       </xsl:if>
  245.       <xsl:if test="'self'!=@rel">
  246.         Link to channel home.
  247.       </xsl:if>
  248.       <!-- <xsl:value-of select="@href" />-->
  249.     </a>
  250.   </xsl:template>
  251.   <xsl:template match="rdf:RDF">
  252.     <div>
  253.       <xsl:attribute name="class">cChannel</xsl:attribute>
  254.       <h1>
  255.         <xsl:attribute name="class">cChannelTitle</xsl:attribute>
  256.         <xsl:value-of select="nsrss:channel/nsrss:title" />
  257.       </h1>
  258.       <xsl:apply-templates select="nsrss:channel" />
  259.       <xsl:if test="nsrss:channel/nsrss:description">
  260.         <div>
  261.           <xsl:attribute name="class">cChannelDescription</xsl:attribute>
  262.           <xsl:value-of select="nsrss:channel/nsrss:description"  />
  263.         </div>
  264.       </xsl:if>
  265.       <div>
  266.         <xsl:attribute name="class">cChannelDate</xsl:attribute>
  267.         <xsl:value-of select="nsrss:channel/dc:date" />
  268.       </div>
  269.       <div>
  270.         <xsl:attribute name="class">cChannelSubject</xsl:attribute>
  271.         <xsl:value-of select="nsrss:channel/dc:subject" />
  272.       </div>
  273.       <xsl:apply-templates select="nsrss:item" />
  274.     </div>
  275.   </xsl:template>
  276.   <xsl:template match="nsrss:item">
  277.     <div>
  278.       <xsl:attribute name="class">cItem</xsl:attribute>
  279.       <xsl:element name="a">
  280.           <xsl:attribute name="name">
  281.           <xsl:value-of select="concat('rssitem',position())"/>
  282.         </xsl:attribute>
  283.       </xsl:element>
  284.       <h2>
  285.         <xsl:attribute name="class">cItemTitle</xsl:attribute>
  286.         <xsl:value-of select="nsrss:title" />
  287.       </h2>
  288.       <a>
  289.         <xsl:attribute name="class">cItemLink</xsl:attribute>
  290.         <xsl:attribute name="href">
  291.           <xsl:value-of select="nsrss:link" />
  292.         </xsl:attribute>
  293.         <xsl:attribute name="title">
  294.           <xsl:value-of select="nsrss:link" />
  295.         </xsl:attribute>
  296.         <!-- <xsl:value-of select="nsrss:link" />-->
  297.         Link to article.
  298.       </a>
  299.       <div>
  300.         <xsl:attribute name="class">cItemDate</xsl:attribute>
  301.         <xsl:value-of select="nsrss:pubDate" />
  302.       </div>
  303.       <div>
  304.         <xsl:attribute name="class">cItemCreator</xsl:attribute>
  305.         <xsl:value-of select="dc:creator" disable-output-escaping="yes"/>
  306.       </div>
  307.       <div>
  308.         <xsl:attribute name="class">cItemDescription</xsl:attribute>
  309.         <xsl:value-of select="nsrss:description"  />
  310.       </div>
  311.       <xsl:if test ="dc:subject">
  312.         <div>
  313.           <xsl:attribute name="class">cItemSubject</xsl:attribute>
  314.           <xsl:value-of select="dc:subject"  disable-output-escaping="yes" />
  315.         </div>
  316.       </xsl:if>
  317.       <xsl:if test ="dc:description">
  318.         <div>
  319.           <xsl:attribute name="class">cItemDescription</xsl:attribute>
  320.           <xsl:value-of select="dc:description"  disable-output-escaping="no" />
  321.         </div>
  322.       </xsl:if>
  323.     </div>
  324.   </xsl:template>
  325.   <xsl:template match="nsrss:channel">
  326.     <a>
  327.       <xsl:attribute name="class">cChannelLink</xsl:attribute>
  328.       <xsl:attribute name="href">
  329.         <xsl:value-of select="nsrss:link" />
  330.       </xsl:attribute>
  331.       <xsl:attribute name="title">
  332.         <xsl:value-of select="nsrss:link" />
  333.       </xsl:attribute>
  334.       <!-- <xsl:value-of select="nsrss:link" />-->
  335.       Link to channel home.
  336.     </a>
  337.   </xsl:template>
  338.   <xsl:template match="rss">
  339.     <xsl:apply-templates select="channel" />
  340.   </xsl:template>
  341.   <xsl:template match="channel">
  342.     <div>
  343.       <xsl:attribute name="class">cChannel</xsl:attribute>
  344.       <h1>
  345.         <xsl:attribute name="class">cChannelTitle</xsl:attribute>
  346.         <xsl:value-of select="title" />
  347.       </h1>
  348.       <a>
  349.         <xsl:attribute name="class">cChannelLink</xsl:attribute>
  350.         <xsl:attribute name="href">
  351.           <xsl:value-of select="link" />
  352.         </xsl:attribute>
  353.         <xsl:attribute name="title">
  354.           <xsl:value-of select="link" />
  355.         </xsl:attribute>
  356.         <!-- <xsl:value-of select="link" />-->
  357.         Link to channel home.
  358.       </a>
  359.       <xsl:if test="itunes:author">
  360.         <div>
  361.           <xsl:attribute name="class">cChannelAuthor</xsl:attribute>
  362.           <xsl:value-of select="itunes:author" />
  363.         </div>
  364.       </xsl:if>
  365.       <xsl:if test="itunes:summary">
  366.         <div>
  367.           <xsl:attribute name="class" >cChannelSummary</xsl:attribute>
  368.           <xsl:value-of select="itunes:summary"  />
  369.         </div>
  370.       </xsl:if>
  371.       <xsl:if test="description">
  372.         <div>
  373.           <xsl:attribute name="class" >cChannelDescription</xsl:attribute>
  374.           <xsl:value-of select="description"  />
  375.         </div>
  376.       </xsl:if>
  377.       <xsl:apply-templates select="item" />
  378.       <div>
  379.         <xsl:attribute name="class">cChannelRights</xsl:attribute>
  380.         <xsl:value-of select="copyright" />
  381.       </div>
  382.     </div>
  383.   </xsl:template>
  384.   <xsl:template match="item">
  385.     <div>
  386.       <xsl:attribute name="class">cItem</xsl:attribute>
  387.       <xsl:element name="a">
  388.           <xsl:attribute name="name">
  389.           <xsl:value-of select="concat('rssitem',position())"/>
  390.         </xsl:attribute>
  391.       </xsl:element>
  392.       <h2>
  393.         <xsl:attribute name="class">cItemTitle</xsl:attribute>
  394.         <xsl:value-of select="title" />
  395.       </h2>
  396.       <xsl:if test="enclosure/@url">
  397.         <a>
  398.           <xsl:attribute name="class">cItemLink</xsl:attribute>
  399.           <xsl:attribute name="href">
  400.             <xsl:value-of select="enclosure/@url" />
  401.           </xsl:attribute>
  402.           <xsl:attribute name="title">
  403.             <xsl:value-of select="enclosure/@url" />
  404.           </xsl:attribute>
  405.           <!-- <xsl:value-of select="enclosure/@url" />-->
  406.           Link to download or open podcast media file.
  407.         </a>
  408.         <br/>
  409.       </xsl:if>
  410.       <a>
  411.         <xsl:attribute name="class">cItemLink</xsl:attribute>
  412.         <xsl:attribute name="href">
  413.           <xsl:value-of select="link" />
  414.         </xsl:attribute>
  415.         <xsl:attribute name="title">
  416.           <xsl:value-of select="link" />
  417.         </xsl:attribute>
  418.         <!-- <xsl:value-of select="link" />-->
  419.         Link to article.
  420.       </a>
  421.       <div>
  422.         <xsl:attribute name="class" >cItemSummary</xsl:attribute>
  423.         <xsl:value-of select="itunes:summary"  />
  424.       </div>
  425.       <div>
  426.         <xsl:attribute name="class" >cItemDescription</xsl:attribute>
  427.         <xsl:value-of select="description" />
  428.       </div>
  429.       <div>
  430.         <xsl:attribute name="class">cItemDate</xsl:attribute>
  431.         <xsl:value-of select="pubDate" />
  432.       </div>
  433.       <xsl:if test="enclosure/@length">
  434.         <span>
  435.           <xsl:attribute name="class">cItemLength</xsl:attribute>
  436.           <b>Length: </b>
  437.           <xsl:value-of select="enclosure/@length" />
  438.         </span>
  439.       </xsl:if>
  440.       <xsl:if test="itunes:duration">
  441.         <span>
  442.           <xsl:attribute name="class">cItemDuration</xsl:attribute>
  443.           <b>Duration: </b>
  444.           <xsl:value-of select="itunes:duration" />
  445.         </span>
  446.       </xsl:if>
  447.     </div>
  448.   </xsl:template>
  449. </xsl:stylesheet>
  450.